<?php
namespace Customer\Controllers;

use Helpers\Controller;
use Helpers\Main;

class ControllerBase extends Controller
{


    public function praseLog($detail,$msg)
    {
        return Main::createCommitLog(
            'customer',
            $this->dispatcher->getControllerName(),
            $this->dispatcher->getActionName(),
            ['post' => $this->request->getPost(), 'get' => $this->request->getQuery(), 'detail' => $detail],
            null,
            $msg
        );
    }

    /**
     * 在每个动作执行前执行的代码
     *
     * @param $dispatcher
     *
     */
    public function beforeExecuteRoute($dispatcher)
    {
        // 这个方法会在每一个能找到的action前执行
        $userId=Main::getLoginUserInfo('userId');
        if(!$userId){
            Main::goLoginPage();
        }
    }


}
